package org.example.memberlist_back.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.memberlist_back.entity.Member;

import java.util.List;

@Mapper
public interface MemberMapper extends BaseMapper<Member> {
    @Select("select * from user ")
    List<Member> selectAllUsers();
    @Select("select * from user where username = #{username}")
    Member selectUserByUsername(String username);
    @Select("delete from user where username = #{username}")
    void deleteUserByUsername(String username);
    @Select("update user set name = #{name}, username = #{username}, password = #{password}, member = #{member} where username = #{username}")
    void updateUser(Member member);
    @Select("insert into user (name, username, password, member) values (#{name}, #{username}, #{password}, #{member})")
    void addUser(Member member);
}
